package cn.edu.njpi;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

/**
 * @author 朱宗辉
 * @version V1.0
 * @Package cn.edu.njpi
 * @date 2022/5/11 9:47 PM
 */
public class Main extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {
        Button b1 = new Button("b1");
        Button b2 = new Button("b2");
        AnchorPane anchorPane = new AnchorPane();
        anchorPane.setStyle("-fx-background-color: red");
        //Group root = new Group();
        //root.setStyle("-fx-background-color: red");
        //root.setOnMouseClicked(mouseEvent -> System.out.println("qwer"));
        anchorPane.getChildren().addAll(b1, b2);
        anchorPane.setOnMouseClicked(mouseEvent -> System.out.println("asdfd"));

        Scene scene = new Scene(anchorPane);
        stage.setScene(scene);
        stage.setTitle("javafx");
        stage.setWidth(800);
        stage.setHeight(800);
        stage.show();
    }
}
